package com.example.basic01;

/**
 * @link {https://blog.csdn.net/weixin_51607490/article/details/121080082}
 */
public class StringFlyWeight {
    public static void main(String[] args) {
        String str1 = "a";
        String str2 = "b";
        String str3 = "ab";
        String str4 = str1 + str2;
        String str5 = new String("ab");

        System.out.println(str5.equals(str3));
        System.out.println(str5 == str3);
        System.out.println(str5.intern() == str3);
        System.out.println(str5.intern() == str4);
    }
}
